package com.zz.bsea.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zz.bsea.web.jdbc.Sc;
import com.zz.bsea.web.jdbc.ScService;

/**
 * Servlet implementation class ScServlet
 */
public class ScServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ScServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String sid1=request.getParameter("sid");
		//String 类型的变量转int类型
		int sid=Integer.parseInt(sid1);
		ScService scs=new ScService();
		List<Sc> ls=scs.getBySid(sid);
		String allrs="";
		for(Sc ts:ls) {
			allrs=allrs+ts.toString()+"****";
		}
		//解决中文乱码问题
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		response.getWriter().append("成绩记录是：: "+allrs);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
